package org.core.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;


public class DateOperation 
{
    private static String strTimeFormat=null;
    
	public DateOperation()
	{
		
	}
	//time Format
	//"yyyy-MM-dd HH:mm:ss"
	public String getCurrentTime()
	{
		SimpleDateFormat df = new SimpleDateFormat(strTimeFormat);//�������ڸ�ʽ
		return df.format(new Date());
	}
	
	//��õ�ǰʱ��,�뼶
	public long getTimetoSecond()
	{
		String  strCurrentTime = this.getCurrentTime();
		Date    df             = null;
		try 
		{
			df =new SimpleDateFormat(strTimeFormat).parse(strCurrentTime);
		} 
		catch (ParseException e) 
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return df.getTime()/1000;//����ת��Ϊ��
	}
	public static String getStrTimeFormat() {
		return strTimeFormat;
	}
	public static void setStrTimeFormat(String strTimeFormat) 
	{
		if (strTimeFormat.length() == 0 || strTimeFormat ==null)//�ַ�δ�գ�Ĭ�ϸ�ʽ
		{
			DateOperation.strTimeFormat="yyyy-MM-dd HH:mm:ss";
		}
		else
		{
	    	DateOperation.strTimeFormat = strTimeFormat;
		}
	}
	
	/*
	public static String getStrTimeFormat() 
	{
		return strTimeFormat;
	}
	
	public static void setStrTimeFormat(String strTimeFormat) 
	{
		if (strTimeFormat.length() == 0 || strTimeFormat ==null)//�ַ�δ�գ�Ĭ�ϸ�ʽ
		{
			strTimeFormat="yyyy-MM-dd HH:mm:ss";
		}
		else
		{
	    	strTimeFormat = strTimeFormat;
		}
	}*/
	
	
	
}
